<?php


class SessionTemplate extends Doctrine_Template
{
	public function setTableDefinition()
    {
    	
    }
    
	public function createSessionKey($clientID, $data=array()){
		$object = $this->getInvoker();
		$object->sessionID = null;
		
		$session = new Passport_SessionDBO();
		$session->sessionKey = md5(rand()).md5(time()+rand());
		$session->clientID=$clientID;
		$session->userIP=REMOTE_ADDR;
		$session->expiredDate = time()+60*60*24*$this->expiredDays;
		$session->loginDate = time();
		foreach ($data as $key=>$item){
			$session->$key=$item;
		}
		$session->save();
		return $session->sessionKey;
	}
}